import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'
import Layout from '../layout'

Vue.use(VueRouter)

const routes = [
  // {
  //   path: '/',
  //   name: 'Home',
  //   component: Home
  // },
  {
    path: '/',
    component: Layout,
    redirect: '/',
    children: [
      {
        path: '/',
        name: 'home',
        meta: {
          title: 'user manager'
        },
        component: () => import('@/views/user-list')
      },
      {
        path: '/system/users',
        name: 'users',
        meta: {
          title: '用户管理'
        },
        component: () => import('@/views/system/users.vue')
      },
      {
        path: '/system/namelist',
        name: 'namelist',
        meta: {
          title: '名单库管理'
        },
        component: () => import('@/views/system/namelist/index.vue')
      }
    ]
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
